home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Source Code / PowerPlant / CDLOGMenuBar / CDLOGMenuBar.h < prev    next >
Text File  |  1996-04-02  |  4KB  |  81 lines

  1. /************************************************************************
  2. *****    File : CDLOGMenuBar.h                                        *****
  3. *****    Copyright 1996, Thomas R. Kimpton                            *****
  4. *****        All Rights Reserved                                        *****
  5. *****                                                                *****
  6. *****    This source code may be freely used in any programming        *****
  7. *****    project so long as credit is duly noted of the author.        *****
  8. ************************************************************************/
  9. #pragma once
  10. //************************************************************************
  11. #pragma mark    standard header files
  12. //************************************************************************
  13. #include <LPane.h>
  14.  
  15. //************************************************************************
  16. #pragma mark    local header files
  17. //************************************************************************
  18.  
  19. //************************************************************************
  20. #pragma mark    constant definitions
  21. //************************************************************************
  22. #define kNumMbarMenus            8        // Max number of menus in dialog menu bar.
  23. #define kMbarMenusIncr            4        // When we increase the size of the menubar
  24.                                         // we add this number of menus
  25.  
  26. const short msg_DLOGMenuBarSelection = 10240;
  27.  
  28. //************************************************************************
  29. #pragma mark    macro definitions
  30. //************************************************************************
  31.  
  32. //************************************************************************
  33. #pragma mark    type definitions
  34. //************************************************************************
  35. typedef struct {
  36.     Rect titleRect;        /* Portion of the menu bar taken by the title of this menu. */
  37.     MenuHandle theMenu;
  38. } auxMenuStruct;
  39.  
  40. //************************************************************************
  41. #pragma mark    class definitions
  42. //************************************************************************
  43. class CDLOGMenuBar :    public LPane,
  44.                         public LBroadcaster {
  45. public:
  46.     enum { class_ID = 'DLMB' };
  47.     static CDLOGMenuBar*    CreatePaneStream(LStream *inStream);
  48.                     CDLOGMenuBar();
  49.                     CDLOGMenuBar(const CDLOGMenuBar &inOriginal);        
  50.                     CDLOGMenuBar(LStream *inStream);
  51.     virtual                ~CDLOGMenuBar();
  52.  
  53.     virtual void        ClickSelf(const SMouseDownEvent &inMouseDown);
  54.     virtual void        DrawSelf(void);    
  55. //    virtual Boolean        HandleKeyPress(const EventRecord    &inKeyEvent);
  56. //    virtual void        BeTarget();
  57.     virtual long        getDlogMenuSelection() { return(mTheSelection); };
  58.     virtual OSErr        insertMenuDlogMenuBar(MenuHandle theMenu,short *whichMenuIndex);
  59.     virtual MenuHandle    getDlogMenuBarMenu(short whichMenuIndex);
  60.  
  61. protected:
  62.     static pascal void            MenuHookProc(void);
  63.  
  64.     Rect            mMBARRect;                // Rect, in window, that comprises the menubar.
  65.     long            mTheSelection;            // The menu/menuItem selected.
  66.     MenuHookUPP        mMenuHook;                // Pointer to routine used in MenuHook.
  67.     short            mCurMaxNumMbarMenus;    // Current number of menus possible in menubar.
  68.     short            mNumMenus;                // Number of menus in this menu bar.
  69.     short            mCurMenu;                // Index into mMenus for menu currently displayed.
  70.     auxMenuStruct    *mMenus;                // Holds the handle and titleRect(within the MBAR) for each menu.
  71. };
  72.  
  73.  
  74. //************************************************************************
  75. #pragma mark    external variables
  76. //************************************************************************
  77.  
  78. //************************************************************************
  79. #pragma mark    external functions
  80. //************************************************************************
  81.